package com.u.statistics.job;


import org.apache.flink.api.common.serialization.SimpleStringSchema;
import org.apache.flink.streaming.api.datastream.DataStream;
import org.apache.flink.streaming.api.environment.StreamExecutionEnvironment;

import java.util.Properties;

/**
 * @program: u-InternetOfThings
 * @description: flink任务
 * @author: Alex Wu
 * @createDate: 2025-03-19 18:10
 **/
// 水位线计算，当达到事件的时间（而不是系统时间）的水位才出发计算
public class FlinkKafkaJob {
    public static void main(String[] args) throws Exception {
      /*  // 1. 创建执行环境
        StreamExecutionEnvironment env = StreamExecutionEnvironment.getExecutionEnvironment();

        // 2. Kafka 配置
        Properties properties = new Properties();
        properties.setProperty("bootstrap.servers", "192.168.102.8:9092");
        properties.setProperty("group.id", "flink-group");

        // 3. 创建 Kafka 消费者
        FlinkKafkaConsumer<String> kafkaConsumer = new FlinkKafkaConsumer<>(
                "test",
                new SimpleStringSchema(),
                properties
        );

        // 4. 读取 Kafka 数据流
        DataStream<String> stream = env.addSource(kafkaConsumer);

        // 5. 处理数据
        stream.map(String::toUpperCase) // 将字符串转换为大写
                .print();

        // 6. 启动 Flink 任务
        env.execute("Flink Kafka Job");*/
    }
}
